/**
 * Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * This file is a part of the CANN Open Software.
 * Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

/*!
 * \file fused_add_topk_div_case.h
 * \brief FusedAddTopkDiv 测试用例.
 */

#pragma once
#include "fused_add_topk_div_param.h"
#include <vector>
#include <cstdint>
#include <exe_graph/runtime/tiling_context.h>
#include <register/op_impl_registry.h>
#include "graph/types.h"
#include "tests/utils/case.h"
#include "tests/utils/op_info.h"
#include "tests/utils/context.h"
#include "tests/utils/tensor.h"

namespace ops::adv::tests::FusedAddTopkDiv {
constexpr int64_t X_INDEX = 0;
constexpr int64_t ADD_NUM_INDEX = 1;
constexpr int64_t MAPPING_NUM_INDEX = 2;
constexpr int64_t MAPPING_TABLE_INDEX = 3;
constexpr int64_t Y_INDEX = 0;
constexpr int64_t INDICES_INDEX = 1;

using ops::adv::tests::FusedAddTopkDiv::Param;
using OpInfo = ops::adv::tests::utils::OpInfo;
using Context = ops::adv::tests::utils::Context;
using Tensor = ops::adv::tests::utils::Tensor;

class FusedAddTopkDivCase : public ops::adv::tests::utils::Case {
public:
    class DoTilingParam {
    public:
        gert::TilingContext *ctx = nullptr;
        ge::graphStatus ret = ge::GRAPH_SUCCESS;
    };
    OpInfo mOpInfo;
    Context mCtx;
    Param mParam;
    Tensor x, addNum, mappingNumOptional, mappingTableOptional, yOut, indicesOut;
    gert::OpImplRegisterV2::TilingKernelFunc fusedAddTopkDivTilingFunc = nullptr;
    FusedAddTopkDivCase();
    FusedAddTopkDivCase(const char *name, bool enable, const char *dbgInfo, OpInfo incre, Param param);
    bool Run() override;
    bool InitParam() override;
    bool InitOpInfo() override;
    bool InitCurrentCasePtr() override;
    bool DoOpTiling(DoTilingParam &tilingParam);
};

} // namespace ops::adv::tests::FusedAddTopkDiv